<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.yaodian100.core.common.utils.ServerValue"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ include file="/taglibs.jsp"%> 
<h1>团购上架管理 - 检视<br/>
<div class="f-link">
	<yaodian100:checkPermission permissions="OTHER_TUANGOUMANAGER">
		<a href="<%=ServerValue.getMidContextPath()%>/shelf2/searchTuangouApprove.do">回团购审核列表页</a>
		<a href="<%=ServerValue.getMidContextPath()%>/shelf2/listTuangou.do">回团购上下架列表页</a>
	</yaodian100:checkPermission>
	<a href="<%=ServerValue.getMidContextPath()%>/shelf2/list.do?productId=${productId}">回上下架列表页</a>
	<a href="<%=ServerValue.getMidContextPath()%>/product/list.do">回商品列表页</a>
</div>
</h1>
<s:if test="hasActionErrors()">
	<s:actionerror cssClass="msg rn"/>
</s:if>
<s:if test="hasActionMessages()">
	<s:actionmessage cssClass="msg rn"/>
</s:if>
<s:if test="hasFieldErrors()">
	<s:fielderror cssClass="msg rn"/>
</s:if>
<script language="javascript">
	$().ready(function(){
		if ( "" != "${shelfTuangou.price}" )
			$("#rate").text(round2places(("${shelfTuangou.price}" - "${product.productCost}")/"${shelfTuangou.price}"*100)+"%");
	});
	//取到小数点第二位
	function round2places(numToRound){ 
		var result; 
		result=numToRound*100; 
		result=Math.round(result); 
		result=result/100; 
		return result;
	}	
</script>
<c-rt:if test="${not empty product.productId}">
	<jsp:include page="/WEB-INF/jsp/product/commonMenu2.jsp"/>
</c-rt:if>
<table class="tb-data" width="100%">	
 	<tr>
		<th>商品名称（商品编号)</th>			
		<td>${product.productName}(${product.productId})</td>
	</tr>
	<tr>
		<th>促销小标</th>			
		<td>${shelfTuangou.promoteName}</td>
	</tr>
  <tr>
		<th>活动起始日期时间</th>			
		<td><fmt:formatDate value="${shelfTuangou.startDate}" pattern="yyyy-MM-dd HH:mm" /></td>
	</tr>
  <tr>
		<th>活动结束日期时间</th>			
		<td><fmt:formatDate value="${shelfTuangou.endDate}" pattern="yyyy-MM-dd HH:mm" /></td>
	</tr>
  <tr>
		<th>团购售价</th>			
		<td>        
		 <fmt-rt:formatNumber pattern="######0.0" value="${shelfTuangou.price}"/>
	   <span class="txt-rd">【※上架售价小数点1位数后无条件舍去】</span><br/>
	   <table  class="tb-data" width="100%">
	   	<tr>
	   		<th>厂商建议售价</th>
	   		<th>提报耀点价</th>
	   		<th>商品成本</th>
	   		<th>分类毛利率限制</th>
			<th>实际毛利率</th>
	   	</tr>
	   	<tr>
	   		<td style="text-align: center;"><fmt-rt:formatNumber pattern="######0.0" value="${product.listPrice}"/></td>
	   		<td style="text-align: center;"><fmt-rt:formatNumber pattern="######0.0" value="${product.prpsShelfPrice}"/></td>
	   		<td style="text-align: center;"><fmt-rt:formatNumber pattern="######0.00" value="${product.productCost}"/></td>
	   		<td style="text-align: center;" class="txt-rd"><fmt-rt:formatNumber pattern="######0.0" value="${grossProfit}"/></td>
			<td style="text-align: center;"><span id="rate"></span></td>
	   	</tr>
	   </table>
    </td>
	</tr>
	<tr>
		<th>活动最低订购人数</th>			
		<td>${shelfTuangou.lowestOrderQty}</td>
  </tr>	
  <tr>
			<th>商品贩售限定</th>
			<td>
				<input name="chkMemberLimit" type="checkbox" id="chkMemberLimit" disabled="disabled" <c:if test="${shelfTuangou.memberLimit eq 'Y'}">checked="checked"</c:if> />
				单个会员限购一次
			</td>
		</tr>
 	<tr>
			<th>销售方式</th>	
			<td>
				<c:if test="${shelfTuangou.salesType eq '1'}">一般</c:if>
				<c:if test="${shelfTuangou.salesType eq '2'}">抽奖</c:if>
			</td>
		</tr>
 	<tr>
 	<tr>
			<th>订购数量</th>
			<td>
				${shelfTuangou.orderQty}(订购) - ${shelfTuangou.cancelQty}(取消) = ${shelfTuangou.orderQty-shelfTuangou.cancelQty}(实际订购)
			</td>
		</tr>
  <tr>
		<th>备注</th>			
		<td>${fn:escapeXml(shelfTuangou.memo)}</td>        
	</tr>
  <c-rt:if test="${not empty shelfTuangou.tuangouId}">
  <tr>
  	<th>申请人</th>
  	<td>${shelfTuangou.createUser}</td>
  </tr>
  <tr>
  	<th>申请时间</th>
  	<td><fmt-rt:formatDate value="${shelfTuangou.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
  </tr>
  <tr>
  	<th>审核人员</th>
  	<td>${shelfTuangou.approveUser}</td>
  </tr>
  <tr>
  	<th>审核时间</th>
  	<td><fmt-rt:formatDate value="${shelfTuangou.approveDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
  </tr>  
  <tr>
  	<th>不同意原因</th>
  	<td>${shelfTuangou.approveFailReason}</td>
  </tr>	  	  
  </c-rt:if>	
</table>
<br/>
<p>售价记录</p>
<table class="tb-1" width="100%">
	<thead>
		<tr>
			<th>上架类别</th>
			<th>日期起</th>
			<th>日期迄</th>
			<th>小标</th>
			<th>售价</th>
			<th>申请人</th>
			<th>申请状态</th>
			<th>申请时间</th>
			<th>异动人</th>
			<th>异动时间</th>
		</tr>
	</thead>
	<tbody>
	<c-rt:forEach items="${shelfTuangouHistoryList}" var="shelfTuangou">
		<tr>
			<td>
				<c:if test="${shelfTuangou.salesType eq '1'}">一般</c:if>
				<c:if test="${shelfTuangou.salesType eq '2'}">抽奖</c:if>
			</td>
			<td><fmt-rt:formatDate value="${shelfTuangou['START_DATE']}" pattern="yyyy-MM-dd HH:mm" /></td>
			<td><fmt-rt:formatDate value="${shelfTuangou['END_DATE']}" pattern="yyyy-MM-dd HH:mm" /></td>
			<td>${shelfTuangou['PROMOTE_NAME']}</td>
			<td><fmt-rt:formatNumber value="${shelfTuangou['PRICE']}" pattern="######0.0" /></td>
			<td>${shelfTuangou['CREATE_USER']}</td>
			<td>${shelfTuangouStatusMenu.options[shelfTuangou['STATUS']].name}</td>
			<td><fmt-rt:formatDate value="${shelfTuangou['CREATE_DATE']}" pattern="yyyy-MM-dd HH:mm" /></td>
			<td>${shelfTuangou['MODIFY_USER']}</td>
			<td><fmt-rt:formatDate value="${shelfTuangou['MODIFY_DATE']}" pattern="yyyy-MM-dd HH:mm" /></td>
		</tr>
	</c-rt:forEach>
	</tbody>
</table>